home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / iritsm3s.zip / MOLECULE.IRT < prev    next >
Text File  |  1992-02-26  |  1KB  |  69 lines

  1. #
  2. # Simple molecule - 8 atoms connected as a cube.
  3. #
  4.  
  5. tm = time(true);
  6.  
  7. save_res = resolution;
  8. save_view = view_mat;
  9.  
  10. view_mat = view_mat * scale(vector(0.6, 0.6, 0.6)) *
  11.               rotx(20) * roty(45) *
  12.               trans(vector(-0.3, 0.2, 0.0));
  13.  
  14. resolution = 8;
  15. S1 = sphere(vector(0.0, 0.0, 0.0), 0.2);
  16. S2 = sphere(vector(1.0, 0.0, 0.0), 0.2);
  17.  
  18. resolution = 4;
  19. C1 = cylin(vector(0.0, 0.0, 0.0), vector(1.0, 0.0, 0.0), 0.05);
  20.  
  21. view(list(S1, S2, C1), true);
  22.  
  23. B1 = S1 + S2 + C1;
  24. free(S1);
  25. free(S2);
  26. free(C1);
  27. B2 = B1 * trans(vector(0.0, 1.0, 0.0));
  28.  
  29. view(list(B1, B2), true);
  30.  
  31. C2 = cylin(vector(0.0, 0.0, 0.0), vector(0.0, 1.0, 0.0), 0.05);
  32. C3 = cylin(vector(1.0, 0.0, 0.0), vector(0.0, 1.0, 0.0), 0.05);
  33.  
  34. B12 = B1 + B2 + (C2 + C3);
  35. free(B1);
  36. free(B2);
  37. free(C2);
  38. free(C3);
  39. B34 = B12 * trans(vector(0.0, 0.0, 1.0));
  40.  
  41. view(list(B12, B34), true);
  42.  
  43. C4 = cylin(vector(0.0, 0.0, 0.0), vector(0.0, 0.0, 1.0), 0.05);
  44. C5 = cylin(vector(0.0, 1.0, 0.0), vector(0.0, 0.0, 1.0), 0.05);
  45. C6 = cylin(vector(1.0, 0.0, 0.0), vector(0.0, 0.0, 1.0), 0.05);
  46. C7 = cylin(vector(1.0, 1.0, 0.0), vector(0.0, 0.0, 1.0), 0.05);
  47.  
  48. B1234 = B12 + B34 + (C4 + C5 + C6 + C7);
  49.  
  50. free(B12);
  51. free(B34);
  52. free(C4);
  53. free(C5);
  54. free(C6);
  55. free(C7);
  56.  
  57. FINAL = convex(B1234);
  58.  
  59. tm = time(false);
  60. tm; # In Seconds
  61.  
  62. beep(700,200);
  63. interact(list(FINAL), 0);
  64.  
  65. save("molecule", list(view_mat, FINAL));
  66.  
  67. resolution = save_res;
  68. view_mat = save_view;
  69.